import { createRouter, createWebHistory } from 'vue-router'

//调用持久化
import { useCounterStore } from '@/stores/counter';


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/MainView',
      name: 'MainView',
      component: () => import('../views/MainView.vue'),
      children: [
        {
          path: '/UserAddView',
          name: 'UserAddView',
          component: () => import('../views/RBACFile/UserAddView.vue'),
        },
        {
          path: '/UserListView',
          name: 'UserListView',
          component: () => import('../views/RBACFile/UserListView.vue'),
        },
        {
          path: '/RolesView',
          name: 'RolesView',
          component: () => import('../views/RBACFile/RolesView.vue'),
        },
        {
          path: '/PermissionView',
          name: 'PermissionView',
          component: () => import('../views/RBACFile/PermissionView.vue'),
        },

        {
          path: '/SheepFarm',
          name: 'SheepFarm',
          component: () => import('../views/Enterprise/SheepFarm.vue'),
        },
        {
          path: '/EnterListView',
          name: 'EnterListView',
          component: () => import('../views/Enterprise/EnterListView.vue'),
        },
        {
          path: '/SheepFarm',
          name: 'SheepFarm',
          component: () => import('../views/Enterprise/SheepFarm.vue'),

        },
        {
          path: '/SheepFarm',
          name: 'SheepFarm',
          component: () => import('../views/Enterprise/SheepFarm.vue'),
        },

        {
          path: '/EnterpriseAddView',
          name: 'EnterpriseAddView',
          component: () => import('../views/Enterprise/EnterpriseAddView.vue'),
        },
        {
          path: '/DepartmentAdd2View',
          name: 'DepartmentAdd2View',
          component: () => import('../views/Enterprise/DepartmentAdd2View.vue'),
        }, {
          path: '/DeparmentListView',
          name: 'DeparmentListView',
          component: () => import('../views/Enterprise/DeparmentListView.vue'),
        }, {
          path: '/Buildings',
          name: 'Buildings',
          component: () => import('../views/Enterprise/Buildings.vue'),
        },
        {
          path: '/RaiseListView',
          name: 'RaiseListView',
          component: () => import('../views/Raise/RaiseListView.vue'),
        },
        {
          path: '/BeginningAddsView',
          name: 'BeginningAddsView',
          component: () => import('../views/Beginning/GetBeginAddView.vue'),
        },
        {
          path: '/DeparmentListView',
          name: 'DeparmentListView',
          component: () => import('../views/Enterprise/DeparmentListView.vue'),
        },

        {
          path: '/MaleArchives',
          name: 'MaleArchives',
          component: () => import('../views/Raise/MaleArchives.vue'),
        },
        {
          path: '/FemaleBeginList',
          name: 'FemaleBeginList',
          component: () => import('../views/Beginning/FemaleBeginList.vue'),
        },
        {
          path: '/MaleBeginAdd',
          name: 'MaleBeginAdd',
          component: () => import('../views/Raise/MaleBeginAdd.vue'),
        },
        {
          path: '/MaleBeginList',
          name: 'MaleBeginList',
          component: () => import('../views/Raise/MaleBeginList.vue'),
        },
        {
          path: '/DescendentList',
          name: 'DescendentList',
          component: () => import('../views/Beginning/DescendentList.vue'),
        },
        {
          path: '/DescendentAdd',
          name: 'DescendentAdd',
          component: () => import('../views/Beginning/DescendentAdd.vue'),
        },

        {
          path: '/SecuritySetting',
          name: 'SecuritySetting',
          component: () => import('../views/Personages/SecuritySetting.vue'),
        }, 
        {
          path: '/PersonSetting',
          name: 'PersonSetting',
          component: () => import('../views/Personages/PersonageSettingView.vue'),
        },
        {
          path: '/GetBeginAddView',
          name: 'GetBeginAddView',
          component: () => import('../views/Beginning/GetBeginAddView.vue'),
        },

        {
          path: '/PersonSetting',
          name: 'PersonSetting',
          component: () => import('../views/Personages/PersonageSettingView.vue'),
        },
        {
          path: '/Descendants_transferList',
          name: 'Descendants_transferList',
          component: () => import('../views/Sheep_Farm_Setup/Descendants_transfer/Descendants_transferList.vue'),
        },
        {
          path: '/Descendants_transferAdd',
          name: 'Descendants_transferList',
          component: () => import('../views/Sheep_Farm_Setup/Descendants_transfer/Descendants_transferAdd.vue'),
        },
        {
          path: '/Seed_mother_history_recordAdd',
          name: 'Seed_mother_history_recordAdd',
          component: () => import('../views/Sheep_Farm_Setup/Seed_mother_history_record/Seed_mother_history_recordAdd.vue'),
        },
        {
          path: '/Seed_mother_history_recordList',
          name: 'Seed_mother_history_recordList',
          component: () => import('../views/Sheep_Farm_Setup/Seed_mother_history_record/Seed_mother_history_recordList.vue'),
        },
        {
          path: '/Month_breddingAdd',
          name: 'Month_breddingAdd',
          component: () => import('../views/Sheep_Farm_Setup/Mother_breeding/Month_breddingAdd.vue'),
        },
        {
          path: '/Moth_breddingList',
          name: 'Moth_breddingList',
          component: () => import('../views/Sheep_Farm_Setup/Mother_breeding/Moth_breddingList.vue'),
        },
        {
          path: '/Buildings',
          name: 'Buildings',
          component: () => import('../views/Enterprise/Buildings.vue'),
        }, {
          path: '/PersonSetting',
          name: 'PersonSetting',
          component: () => import('../views/Personages/PersonageSettingView.vue'),
        },
        {
          path: '/LambEarTagsList',
          name: 'LambEarTagsList',
          component: () => import('../views/EarTagManagements/LambEarTagsListView.vue'),
        },
        {
          path: '/LambEarTagsAdd',
          name: 'LambEarTagsAdd',
          component: () => import('../views/EarTagManagements/LambEarTagsAddView.vue'),
        },
        {
          path: '/SheepWearMark',
          name: 'SheepWearMark',
          component: () => import('../views/EarTagManagements/SheepWearMarkView.vue'),
        },{
          path: '/RecordView',
          name: 'RecordView',
          component: () => import('../views/Record/RecordView.vue'),
        },{
          path: '/SleepInforView',
          name: 'SleepInforView',
          component: () => import('../views/Record/SleepInforView.vue'),
          children:[{
            path: '/FamilyView',
          name: 'FamilyView',
          component: () => import('../views/Record/FamilyView.vue'),
          }]
        },{
          path: '/MaleRecordView',
          name: 'MaleRecordView',
          component: () => import('../views/Record/MaleRecordView.vue'),
        },{
          path: '/ProRecordView',
          name: 'ProRecordView',
          component: () => import('../views/Record/ProRecordView.vue'),
        },{
          path: '/FemaleRecordView',
          name: 'FemaleRecordView',
          component: () => import('../views/Record/FemaleRecordView.vue'),
        },
        {
          path: '/Descendants_transferAdd',
          name: 'Descendants_transferAdd',
          component: () => import('../views/Sheep_Farm_Setup/Descendants_transfer/Descendants_transferAdd.vue'),
        },
        {
          path: '/Descendants_transferList',
          name: 'Descendants_transferList',
          component: () => import('../views/Sheep_Farm_Setup/Descendants_transfer/Descendants_transferList.vue'),
        },{
          path: '/Mother_breedingList',
          name: 'Mother_breedingList',
          component: () => import('../views/Sheep_Farm_Setup/Mother_breeding/Moth_breddingList.vue'),
        },
        {
          path: '/Month_breddingAdd',
          name: 'Month_breddingAdd',
          component: () => import('../views/Sheep_Farm_Setup/Mother_breeding/Month_breddingAdd.vue'),
        },{
          path: '/SleepWeiAddView',
          name: 'SleepWeiAddView',
          component: () => import('../views/WeightSleep/SleepWeiAddView.vue'),
        },{
          path: '/BodyMeausAddView',
          name: 'BodyMeausAddView',
          component: () => import('../views/WeightSleep/BodyMeausAddView.vue'),
        },{
          path: '/PhaseMeausAddView',
          name: 'PhaseMeausAddView',
          component: () => import('../views/WeightSleep/PhaseMeausAddView.vue'),
        },{
          path: '/SleepWeiListView',
          name: 'SleepWeiListView',
          component: () => import('../views/WeightSleep/SleepWeiListView.vue'),
        },{
          path: '/BodyMeausListView',
          name: 'BodyMeausListView',
          component: () => import('../views/WeightSleep/BodyMeausListView.vue'),
        },{
          path: '/PhaseMeausListView',
          name: 'PhaseMeausListView',
          component: () => import('../views/WeightSleep/PhaseMeausListView.vue'),
        },
        {
          path: '/Mother_weaningAdd',
          name: 'Mother_weaningAdd',
          component: () => import('../views/Sheep_Farm_Setup/Mother_weaning/Mother_weaningAdd.vue'),
        },
        {
          path: '/Mother_weaningList',
          name: 'Mother_weaningList',
          component: () => import('../views/Sheep_Farm_Setup/Mother_weaning/Mother_weaningList.vue'),
        },
        {
          path: '/ChildbirthTips',
          name: 'ChildbirthTips',
          component: () => import('../views/PromptReport/ChildbirthTips.vue'),
        },
        {
          path: '/PendingPrompts',
          name: 'PendingPrompts',
          component: () => import('../views/PromptReport/PendingPrompts.vue'),
        },
        {
          path: '/pregnancyTest',
          name: 'pregnancyTest',
          component: () => import('../views/PromptReport/pregnancyTest.vue'),
        },
        {
          path: '/SheepDeathAdd',
          name: 'SheepDeathAdd',
          component: () => import('../views/RaiseOnlyManagement/SheepDeathAdd.vue'),
        },
        {
          path: '/SheepDeathList',
          name: 'SheepDeathList',
          component: () => import('../views/RaiseOnlyManagement/SheepDeathList.vue'),
        },{
    path: '/BreedingSalesAddView',
          name: 'BreedingSalesAddView',
          component: () => import('../views/Sales_Purchase/BreedingSales/BreedingSalesAddView.vue'),
        },
        {
          path: '/BreedingSalesListView',
          name: 'BreedingSalesListView',
          component: () => import('../views/Sales_Purchase/BreedingSales/BreedingSalesListView..vue'),
        },
        {
          path: '/PersonalProcurementAddView',
          name: 'PersonalProcurementAddView',
          component: () => import('../views/Sales_Purchase/PersonalProcurement/PersonalProcurementAddView.vue'),
        },
        {
          path: '/PersonalProcurementList',
          name: 'PersonalProcurementList',
          component: () => import('../views/Sales_Purchase/PersonalProcurement/PersonalProcurementList.vue'),
        },
        {
          path: '/Mother_HybirdizationAdd',
          name: 'Mother_HybirdizationAdd',
          component: () => import('../views/Sheep_Farm_Setup/Mother_Hybridization/Mother_HybridizationAddView.vue'),
        },
        {
          path: '/Mother_HybirdizationList',
          name: 'Mother_HybirdizationList',
          component: () => import('../views/Sheep_Farm_Setup/Mother_Hybridization/Mother_HybridizationListView.vue'),
        },{
          path: '/RealInventoryView',
          name: 'RealInventoryView',
          component: () => import('../views/StatisticalInventory/RealInventoryView.vue'),
        },
        {
          path: '/EliminateAdd',
          name: 'EliminateAdd',
          component: () => import('../views/SheepManagement/EliminateAdd.vue'),
        },
        {
          path: '/EliminateList',
          name: 'EliminateList',
          component: () => import('../views/SheepManagement/EliminateListView.vue'),
        },{
          path: '/SleepHomePageView',
          name: 'SleepHomePageView',
          component: () => import('../views/StatisticalInventory/SleepHomePageView.vue'),
        },
        {
          path: '/SheepTransferAdd',
          name: 'SheepTransferAdd',
          component: () => import('../views/Sheep_Farm_Setup/SheepTransfer/SheepTransferAddView.vue'),
        },
        {
          path: '/SheepTransferList',
          name: 'SheepTransferList',
          component: () => import('../views/Sheep_Farm_Setup/SheepTransfer/SheepTransferListView.vue'),
        },
        {
          path: '/InventoryStatistics',
          name: 'InventoryStatistics',
          component: () => import('../views/StatisticalInventory/InventoryStatistics.vue'),
        }
      ]
    },

    {
      path: '/',
      name: 'LoginView',
      component: () => import('../views/LoginView.vue'),
    },

  ]
},
)

//导航守卫
// router.beforeEach((to, from, next) => {
//   const counterStore = useCounterStore();
//   if (to.name == 'LoginView' ) {
//     next();
//     return;
//   }
//   else {
//     if (counterStore.loginStatus)
//     {
//       next();
//     }
//     else {
//       //如果没有登录，则跳转到登录页面
//       next('/');
//     }
//   }
// })


export default router
